import instacne from "../request";
import type { Ref } from "vue";

interface returnReason{
    keyword?: string | Ref<string>;
    pageNum?: number | Ref<number>;
    pageSize?: number | Ref<number>;
}

interface returnReasonlist{
    createTime:string
    id: number,
    name: string,
    sort: number,
    status: number,
    ischeck?:boolean
    

}
interface returnReasonlisttwo{
    list:returnReasonlist[]
    pageNum: number;
    pageSize: number;
    total: number;
    totalPage: number;

}

// /returnReason/list

const getreturnReasonlist = (data?: returnReason): Promise<returnReasonlisttwo> => {
    return instacne.get("/returnReason/list", {
      params: data,
    });
  };
//   /returnReason/delete
const getreturnReasonlistdel = (data:number) => {
    return instacne.post(`/returnReason/delete?ids=${data}`);
  };

  // /returnReason/create
  const getreturnReasonlistadd = (data: returnReasonlist): Promise<returnReasonlist> => {
    return instacne.post("/returnReason/create", data);
  };
  // /returnReason/update/{id}
  const getreturnReasonlistUpdate = (data: returnReasonlist) => {
    return instacne.post(`/returnReason/update/${data.id}`, data);
  };
  // /returnReason/update/status
  const getreturnReasonlistUpdatestatus = (data: returnReasonlist) => {
    return instacne.post(`/returnReason/update/status?status=${data.status}&ids=${data.id}`);
  };
  export {getreturnReasonlist,getreturnReasonlistdel,getreturnReasonlistadd,getreturnReasonlistUpdate,getreturnReasonlistUpdatestatus}
  export type { returnReasonlist};